'use strict';

const Controller = require('../base_controller');

class TestController extends Controller {
  // 测试路由
  async test1() {
    const { ctx } = this;
    const recordResult = await ctx.model.Record.findAll({ order: [[ 'id', 'DESC' ]] })
      .then(data => {
        return { success: true, data };
      }).catch(e => {
        return { success: false, e };
      });
    if (!recordResult.success) {
      this.httpError500({ data: null });
      return;
    }
    this.success({ data: recordResult.data });
  }

}

module.exports = TestController;
